<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>filter</title>
  <script src="https://unpkg.com/vue/dist/vue.js"></script>
</head>

<body>
  <div id="app">
    <ul>
      <!--添加两个过滤器,注意不要冲突,注意先后顺序-->
      <!-- 过滤传值，带引号的是字符串，不带是number,传的值可以动态绑定-->
      <li v-for="item in list">{{item.id | filterAdd1(Number(input),20) | filterAdd2}}</li>
    </ul>
    <input type="text" placeholder="place" v-model="input">
  </div>
</body>
<script>
  Vue.filter('filterAdd1', function (value, one, two) {
    return value + one + two;//默认第一个参数就是默认要过滤的那个值
  })
  Vue.filter('filterAdd2', function (value) {
    return '$' + value;
  })
  var vm = new Vue({
    el: '#app',
    data() {
      return {
        input: 5,
        list: [
          { "id": 0, "title": "11111", "cont": "111111" },
          { "id": 1, "title": "22222", "cont": "111111" },
          { "id": 2, "title": "33333", "cont": "111111" },
          { "id": 3, "title": "44444", "cont": "111111" },
        ]
      }
    },
    methods: {
    },
    mounted() {
    }
  })
</script>

</html>